import { aop } from "../function/aop/aop"

// 切面
export function Asepect() {
    return ((target) => {
        aop.addAspect(target)
    })
}

//切点  顺带进行advice注册
export function Pointcut(expression: Array<string>, advices?: Array<Function>) {
    return (target: unknown, propertyKey: string) => {
        aop.addPointCut({
            clazz: target.constructor,
            expressions: expression,
            pointCutName: propertyKey,
        })
        if (advices) {
            aop.addAdvice(target.constructor, propertyKey, advices)
        }
    }
}

